package ModelLayer;

import java.util.ArrayList;

public class Treatment extends Product 
{
	private int estimatedTime;
	private TreatmentCategory treatmentCategory;
	private ArrayList<Booking> bookings;
	private ArrayList<Treatment> subTreatments;
	
	public Treatment()
	{
		subTreatments = new ArrayList<Treatment>();
		bookings = new ArrayList<Booking>();
	}
	
	public Treatment(int id)
	{
		super(id);
	}
	
	public Treatment(int id, String title, String type, String description, double price, int estimatedTime, TreatmentCategory treatmentCategory)
	{
		super(id, title, type, description, price);
		
		this.estimatedTime = estimatedTime;
		this.treatmentCategory = treatmentCategory;
		bookings = new ArrayList<Booking>();
	}
	
	public void setEstimatedTime(int estimatedTime)
	{
		this.estimatedTime = estimatedTime;
	}
	
	public int getEstimatedTime()
	{
		return estimatedTime;
	}

	public void setTreatmentCategory(TreatmentCategory treatmentCategory) 
	{
		this.treatmentCategory = treatmentCategory;
	}
	
	public TreatmentCategory getTreatmentCategory() 
	{
		return treatmentCategory;
	}

	public void setBookings(ArrayList<Booking> bookings) 
	{
		this.bookings = bookings;
	}
	
	public ArrayList<Booking> getBookings() 
	{
		return bookings;
	}
	
	public void addTreatment(Treatment treat)
	{
		subTreatments.add(treat);
	}

	public ArrayList<Treatment> getSubTreatments() {
		return subTreatments;
	}
	
	public void calcTotalTime()
	{
		if(subTreatments.size() > 0)
		{
			int total = 0;
			
			for(Treatment treat : subTreatments)
			{
				total += treat.getEstimatedTime();
			}
			
			estimatedTime = total;
		}
	}
}
